package action

import (
	"context"
	"trusteva/app/rbac/model"

	"trusteva/app/rbac/internal/svc"
	"trusteva/app/rbac/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ActionDeleteLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewActionDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ActionDeleteLogic {
	return &ActionDeleteLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ActionDeleteLogic) ActionDelete(req *types.ActionDeleteRo) (resp *types.BaseRsp, err error) {
	err = l.svcCtx.DB.WithContext(l.ctx).Where("Id=?", req.ActionId).
		Delete(&model.ActionConfig{}).Error

	return
}
